#题目21： 创建一个文本文件，并写入一些内容。然后编写一个程序来读取该文件的内容，并打印到屏幕上。
def write_content(content):
    with open('test.txt', 'w') as f:
        f.write(content)


def  read_content():
    content=''
    with open('test.txt', 'r') as f:
        content= f.read()
    return content


if __name__ == '__main__':
    write_content('Hello, World!\nThis is an example file.')
    print(read_content())

